<#include "../common/_layout.html" />
<@head title="编辑">
<style type="text/css">
	.cll {
		background-color: #ddd;
	}
</style>
</@head>
<@layout menu='/resource'>

<section class="content">
	<div class="row">
		<div class="col-xs-12">
			<div class="box">
				<form action="${ctx}/resource/save" method="post" role="form">
					<legend>添加/修改信息</legend>
					
                      <input type="hidden" name="id" id="id" value="${resource.id!}" readonly="readonly">
					
					
					<div class="form-group">
						<label for="description">权限描述</label>
                        <textarea id="description" name="description" class="form-control" rows="5">${resource.description!}</textarea>
					</div>
					
						<input type="hidden" class="form-control" id="isSystem" name="isSystem" placeholder="是否是管理员" value="${resource.isSystem!}">
					
					<div class="form-group">
						<label for="pid">父级菜单</label><span id="errorMessage" style="display: none;"></span>
						 <select name="pid"  class="form-control">
						 <#list ResourceMap.keySet() as k>
                 <option value="${k}" <#if resource.getPid()??&&resource.getPid()==k?eval >selected="selected"</#if>>${ResourceMap.get(k)}</option>
                </#list>
              
              
                </select>
					</div>
					<div class="form-group">
						<label for="name">权限名</label>
						<input type="text" class="form-control" id="name" name="name" placeholder="权限名" value="${resource.name!}">
					</div>
					<div class="form-group">
						<label for="orderList">排序list</label>
						<input type="number" class="form-control" id="orderList" name="orderList" placeholder="排序list" value="${resource.orderList!}">
					</div>
					<div class="form-group">
						<label for="description">路径管理<small style="color: #00a65a">***链接去"／"，多个采用","分割，第一个为菜单跳转链接</small></label>
						<textarea id="action" name="action" class="form-control" rows="3">${resource.action!}</textarea>
					</div>
					<button type="submit" class="btn btn-primary">保存</button><button type="submit" class="btn btn-cancle" onclick="javascript :history.back(-1);">返回</button>
				</form>
			</div>
		</div>
	</div>
</section>
</@layout>
<@scripts>
<script type="text/javascript">
	$(document).ready(function(){
		$("#pid").bind("change",function(){
			if($("#pid").val()==$("#id").val()){
				$("#errorMessage").attr("style","display:block;color:red;");
				$("#errorMessage").text("父id不能为自身id!");
				$("#pid").val(0);
				
			}
			else{
			
				$("#errorMessage").text("");
			}
		});

	});
</script>
</@scripts>